{% extends "one_column_body.html" %}
{% import "macros.html" as macros %}
<!-- complete.html -->
{#
views calling this template: 
* django_authopenid.views.register with login_type='openid'
* django_authopenid.views.signin - with login_type='legacy'

purpose of this template is to allow user enter his/her name
email and sign up for email alerts at the initial registratio

parameters:
* provider 
* login_type openid|legacy
* username (same as screen name or username in the models, and nickname in openid sreg)
* openid_register_form
* openid_verify_form - not clear what this form is supposed to do, not used for legacy
* openid_username_exists
#}
{% block head %}{% endblock %}
{% block title %}{% spaceless %}{% trans %}Registration{% endtrans %}{% endspaceless %}{% endblock %}
{% block body_class %}registration-page{% endblock %}
{% block content %}
    <h1 class="section-title">{% trans %}User registration{% endtrans %}</h1>
    {% if openid_register_form.errors %}
        <ul class="errorlist">
        {% for error in openid_register_form.non_field_errors() %}
            <li>{{error}}</li>
        {% endfor %}
        </ul>
    {% endif %}
    <div class="login">
        <form 
            id="register-form"
            name="fregister" 
            {% if login_type=='openid' %}
                action="{% url user_register %}"
            {% elif login_type=='facebook' %}
                action=""
            {% else %}
                action="{{ default_form_action }}"
            {% endif %}
            method="POST"
        >{% csrf_token %}
            {{ openid_register_form.next }}
            <div class="form-row-vertical">
                <label for="id_username">
                    {%- trans %}<strong>Screen Name</strong> (<i>will be shown to others</i>){% endtrans %}
                </label>
                {% if openid_register_form.username.errors %} 
                    <p class="error">{{ openid_register_form.username.errors|join(", ") }}</p>
                {% endif %}
                {{ openid_register_form.username }}
            </div>
            <div class="form-row-vertical margin-bottom">
                <label for="id_email">
                    {%- trans %}<strong>Email Address</strong> (<i>will <strong>not</strong> be shared with 
anyone, must be valid</i>)
                    {% endtrans -%}
                </label>
                {% if openid_register_form.email.errors %} 
                    <p class="error">{{ openid_register_form.email.errors|join(", ") }}</p>
                {% endif %}
                {{ openid_register_form.email }}
            </div>
            {% if openid_register_form.recaptcha %}
            <div class="form-row-vertical">
                {{ macros.form_field_with_errors(openid_register_form.recaptcha ) }}
            </div>
            {% endif %}
            <div class="submit-row">
                <input 
                    id="register-button"
                    type="submit"
                    name="bnewaccount"
                    value="{% trans %}Signup{% endtrans %}"
                />
            </div>
        </form>
    </div>
{% endblock %}
<!-- end complete.html -->
{% block endjs %}
    <script type="text/javascript">
        $('#id_username').focus();
    </script>
    {{ macros.one_shot_form_js(form='#register-form', submit_button='#register-button') }}
{% endblock %}
